﻿@model SmallJob.Model.MConversation
@{
    var userid = (int)ViewData["curuserid"];
    var client = (Model.Person1ID == userid ? Model.User2 : Model.User1);
    var host = (Model.Person2ID == userid ? Model.User2 : Model.User1);
}
<div class="wrapper-all-message">
    @foreach (var item in Model.Messages)
    {
        var sender = (item.SenderID == userid ? host : client);
        <div class="conversation-message">
            <div class="conversation-avatar pull-left">
                <img src="@(string.IsNullOrWhiteSpace(sender.Avatar) ? Url.Content("~/Content/img/blank-avatar.jpg") : sender.Avatar)?w=32&h=32&q=90&format=jpg&mode=crop" />
            </div>
            <div class="conversation-body">
                <p class="inbox-meta">
                    <a   class="inbox-sender" href="/@(string.IsNullOrWhiteSpace(sender.UserName) ? sender.ID.ToString() : sender.UserName)">@sender.Name  </a>
                    <span class="inbox-date">@string.Format("{0:t}", item.Date)</span>
                </p>
                <p class="inbox-message">
                    @item.Content
                </p>
            </div>
        </div>
    }
</div>
@if (ViewData["nextpage"] != null)
{
    <a data-nextpage="@ViewData["nextpage"]" id="new-next-page">Lấy thêm tin nhắn cũ.</a>
}